#ifndef GAMEWINDOW_H
#define GAMEWINDOW_H

#include <QDeclarativeItem>
#include <QDeclarativeEngine>
#include <QTime>
#include "screen.h"

    class GameWindow : public Screen
    {
        Q_OBJECT

    public:
        explicit GameWindow(QDeclarativeEngine* eng =0, int nCake=0);
        ~GameWindow();

    public:
        unsigned int getTickCount() const;
        void create();
        void destroy();

        void addCake();
        void updateCake(float delta);
        void destroyCake();
        bool cekCollision (int x1, int y1, int w1, int h1, int x2, int y2, int w2, int h2);
        void stackCake(QDeclarativeItem *cake);
        void generateSoal();
        void redrawSoal();
        bool isRightCake(QString type);
        void nextSoal();
        void clearPlate();

    signals:

    public slots:
        void pause();
        void resume();

    protected:
        void update(const float frameDelta);

    private: // Data
        float m_lastupdate;
        int nStack;
        int score;
        int life;
        QDeclarativeItem *myGameScreen;
        QDeclarativeItem *myPlate;
        QDeclarativeItem *myOrderList;
        QDeclarativeItem *myscore;
        QDeclarativeItem *mylife;
        QList<QDeclarativeItem *> cakeList;
        QList<QDeclarativeItem *> delCakeList;
        QList<QDeclarativeItem *> colCakeList;
        QList<QDeclarativeItem *> soalCake;


    };
#endif // GAMEWINDOW_H
